#include "ResultFormatter.h"
#include <iostream>

using namespace std;

void ResultFormatter::printResult(ADCM_Computer& adcmPC, CM_ResultCollection& cmRes)
{
	EnterCriticalSection(this);

	wcout << "********************** COMPUTER ********************* " << endl;
	wcout << "ID: " << adcmPC.getIdComputer() << endl;
	wcout << "Name: " << adcmPC.getCn() << endl;

	wcout << "           Computer Changes" << endl;
	
	// Show process vector
	WMI_Result<WMI_Process> wmiRes = cmRes.getProcesses();	
	vector<WMI_Process*> vec = wmiRes.getObjects();

	if (!vec.empty())
	{
		
		vector<WMI_Process*>::iterator iter;
		wcout << L"**************  PROCESS *******" << endl;

		for(iter = vec.begin(); iter != vec.end(); iter++)		
			wcout << L"Name: " << (*iter)->getCaption() << endl;
	}	

	LeaveCriticalSection(this);
}